<template>
<div class="code-input-main">
    <div class="code-input-main-item"><span v-if="code[0]"></span></div>
    <div class="code-input-main-item"><span v-if="code[1]"></span></div>
    <div class="code-input-main-item"><span v-if="code[2]"></span></div>
    <div class="code-input-main-item"><span v-if="code[3]"></span></div>
    <div class="code-input-main-item"><span v-if="code[4]"></span></div>
    <div class="code-input-main-item"><span v-if="code[5]"></span></div>
    <input class="code-input-input"  v-model="code" maxlength="6" :selection-start="-1" :selection-end="-1" type="number"  @input="inputFunc" />
        </div>
</template>

<script>
export default {
    props:{
        code:{
            type:String,
            default:'',
        }
    },
    data() {
        return {
            // code: ''
        }
    },
    methods: {
        inputFunc(e) {
            this.$emit('inputChange',e)
        }
    },
}
</script>

<style>
.code-input-main {
    position: relative;
    height: 56px;
    box-sizing: border-box;
    padding: 0 18px;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    /* background-color: #ddd; */
}

.code-input-main-item {
    opacity: 0.85;
    /* border-bottom: solid pink 1rpx; */
    border: solid #ddd 1rpx;
    border-right: 0;
    align-items: center;
    display: flex;
    justify-content: center;
    color: #333333;
    height: 100%;
    width: 56px;
    background: rgba(255, 255, 255, 1);
}
.code-input-main .code-input-main-item:last-of-type {
     border-right: solid #ddd 1rpx!important;
}
.code-input-main-item span{
    height: 20px;
    width: 20px;
    border-radius: 50%;
    background:#666;
    display: block;
}

.code-input-input {
    position: absolute;
    left: -100%;
    bottom: 0;
    height: 56px;
    width: 300%;
    outline: none;
    color: transparent;
    text-shadow: 0 0 0 transparent;
   
}
</style>